function testHello () {
  axios.get('/test/hello').then(resp => {
    console.log(resp.data);
  }).catch(e => {
    console.log(e);
  });
}

function testPost () {
  axios.post('/test/test-post', {
    username: 'linlifengx',
    birthYear: 1999,
  }).then(resp => {
    return resp.data;
  }).catch(e => {
    console.error(e);
    if (e.response) {
      return e.response.data;
    }
  }).then(data => {
    console.log(data);
  });
}

function testPut () {
  axios.put('/test/test-put', {
    username: 'linlifengx',
    birthYear: 1999,
  }).then(resp => {
    return resp.data;
  }).catch(e => {
    console.error(e);
    if (e.response) {
      return e.response.data;
    }
  }).then(data => {
    console.log(data);
  });
}

function testPatch () {
  axios.patch('/test/test-patch', {
    username: 'linlifengx',
    birthYear: 1999,
  }).then(resp => {
    return resp.data;
  }).catch(e => {
    console.error(e);
    if (e.response) {
      return e.response.data;
    }
  }).then(data => {
    console.log(data);
  });
}

function testDelete () {
  axios.delete('/test/test-delete', {
    username: 'linlifengx',
    birthYear: 1999,
  }).then(resp => {
    return resp.data;
  }).catch(e => {
    console.error(e);
    if (e.response) {
      return e.response.data;
    }
  }).then(data => {
    console.log(data);
  });
}

function testDelete2 () {
  axios.delete('/test/test-delete2', {
    username: 'linlifengx',
    birthYear: 1999,
  }).then(resp => {
    return resp.data;
  }).catch(e => {
    console.error(e);
    if (e.response) {
      return e.response.data;
    }
  }).then(data => {
    console.log(data);
  });
}


function testPager () {
  axios.get('/test/test-pager', {
    params: {
      pager: JSON.stringify({
        pageNo: 1,
        pageSize: 100,
        orderBy: [{
          field: 'asdf',
          isDesc: true,
        }, {
          field: 'aaa',
          isDesc: false,
        }],
        search: [{
          key: 'type',
          op: 'eq',
          value: '12312'
        }, {
          key: 'name',
          op: 'like',
          value: 'abc'
        }]
      })
    }
  }).then(resp => {
    return resp.data;
  }).catch(e => {
    console.error(e);
    if (e.response) {
      return e.response.data;
    }
  }).then(data => {
    console.log(data);
  });
}